//
//  visitorView.swift
//  Swift微博
//
//  Created by adel on 2017/8/18.
//  Copyright © 2017年 com.bailun91. All rights reserved.
//

import UIKit

class visitorView: UIView {

    // MARK:控件属性
    @IBOutlet weak var tipLabel: UILabel!
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var rotationView: UIImageView!
    @IBOutlet weak var loginBtn: UIButton!
    @IBOutlet weak var registerBtn: UIButton!

    
    class func visitorView() ->visitorView{
        return Bundle.main.loadNibNamed("visitorView", owner: nil, options: nil)!.first as! visitorView
    }
    
    // MARK:- 自定义函数
    func setupVisitorViewInfo(_ iconName : String, title : String) {
    
        iconView.image = UIImage(named: iconName)
        tipLabel.text = title
        rotationView.isHidden = true
        
    }
    
    func addRotationAnim() {
        // 1.创建动画
        let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
        
        // 2.设置动画的属性
        rotationAnim.fromValue = 0
        rotationAnim.toValue = Double.pi * 2
        rotationAnim.repeatCount = MAXFLOAT
        rotationAnim.duration = 5
        rotationAnim.isRemovedOnCompletion = false
        
        // 3.将动画添加到layer中
        rotationView.layer.add(rotationAnim, forKey: nil)
    }

    
}

